home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / csD Email 24194862001.psc / frmEmailSetup.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-08-07  |  11.8 KB  |  392 lines

  1. VERSION 5.00
  2. Begin VB.Form frmEmailSetup 
  3.    BackColor       =   &H00FFFFFF&
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    ClientHeight    =   5295
  6.    ClientLeft      =   45
  7.    ClientTop       =   45
  8.    ClientWidth     =   5775
  9.    ControlBox      =   0   'False
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    Picture         =   "frmEmailSetup.frx":0000
  14.    ScaleHeight     =   5295
  15.    ScaleWidth      =   5775
  16.    ShowInTaskbar   =   0   'False
  17.    StartUpPosition =   3  'Windows Default
  18.    Begin VB.TextBox txtDomain 
  19.       BackColor       =   &H00FFC0C0&
  20.       Height          =   285
  21.       Left            =   3240
  22.       TabIndex        =   17
  23.       Text            =   "yahoo.com.au"
  24.       Top             =   1200
  25.       Width           =   2055
  26.    End
  27.    Begin VB.CheckBox chkSavePAssword 
  28.       BackColor       =   &H00800000&
  29.       Caption         =   "Check1"
  30.       Height          =   255
  31.       Left            =   3000
  32.       TabIndex        =   14
  33.       Top             =   1560
  34.       Value           =   1  'Checked
  35.       Width           =   255
  36.    End
  37.    Begin VB.CommandButton cmdAddPOP 
  38.       BackColor       =   &H00800000&
  39.       Caption         =   "+"
  40.       Height          =   255
  41.       Left            =   5400
  42.       MaskColor       =   &H00C00000&
  43.       TabIndex        =   13
  44.       Top             =   480
  45.       Width           =   255
  46.    End
  47.    Begin VB.CommandButton cmdAddSMTP 
  48.       BackColor       =   &H00800000&
  49.       Caption         =   "+"
  50.       Height          =   255
  51.       Left            =   5400
  52.       MaskColor       =   &H00C00000&
  53.       TabIndex        =   12
  54.       Top             =   840
  55.       Width           =   255
  56.    End
  57.    Begin VB.ComboBox cmbSMTP 
  58.       BackColor       =   &H00FFC0C0&
  59.       Height          =   315
  60.       Left            =   1200
  61.       TabIndex        =   11
  62.       Text            =   "smtp.mail.yahoo.com"
  63.       Top             =   840
  64.       Width           =   4095
  65.    End
  66.    Begin VB.ComboBox cmbPOP 
  67.       BackColor       =   &H00FFC0C0&
  68.       Height          =   315
  69.       Left            =   1200
  70.       TabIndex        =   10
  71.       Text            =   "pop.mail.yahoo.com"
  72.       Top             =   480
  73.       Width           =   4095
  74.    End
  75.    Begin VB.TextBox txtPass 
  76.       BackColor       =   &H00FFC0C0&
  77.       Height          =   285
  78.       IMEMode         =   3  'DISABLE
  79.       Left            =   1200
  80.       PasswordChar    =   "*"
  81.       TabIndex        =   7
  82.       Text            =   "s6706271"
  83.       Top             =   1560
  84.       Width           =   1695
  85.    End
  86.    Begin VB.TextBox txtUsername 
  87.       BackColor       =   &H00FFC0C0&
  88.       Height          =   285
  89.       Left            =   1200
  90.       TabIndex        =   6
  91.       Text            =   "muhdfuad"
  92.       Top             =   1200
  93.       Width           =   1695
  94.    End
  95.    Begin VB.Label Label9 
  96.       Appearance      =   0  'Flat
  97.       BackColor       =   &H80000005&
  98.       BackStyle       =   0  'Transparent
  99.       Caption         =   "@"
  100.       ForeColor       =   &H0000FF00&
  101.       Height          =   255
  102.       Left            =   3000
  103.       TabIndex        =   16
  104.       Top             =   1200
  105.       Width           =   255
  106.    End
  107.    Begin VB.Label Label8 
  108.       Appearance      =   0  'Flat
  109.       BackColor       =   &H80000005&
  110.       BackStyle       =   0  'Transparent
  111.       Caption         =   "Save Password ?"
  112.       ForeColor       =   &H0000FF00&
  113.       Height          =   255
  114.       Left            =   3240
  115.       TabIndex        =   15
  116.       Top             =   1560
  117.       Width           =   1575
  118.    End
  119.    Begin VB.Label Label7 
  120.       Appearance      =   0  'Flat
  121.       BackColor       =   &H80000005&
  122.       BackStyle       =   0  'Transparent
  123.       Caption         =   "Username :"
  124.       ForeColor       =   &H0000FF00&
  125.       Height          =   255
  126.       Left            =   120
  127.       TabIndex        =   9
  128.       Top             =   1200
  129.       Width           =   735
  130.    End
  131.    Begin VB.Label Label6 
  132.       Appearance      =   0  'Flat
  133.       BackColor       =   &H80000005&
  134.       BackStyle       =   0  'Transparent
  135.       Caption         =   "Password"
  136.       ForeColor       =   &H0000FF00&
  137.       Height          =   255
  138.       Left            =   120
  139.       TabIndex        =   8
  140.       Top             =   1560
  141.       Width           =   735
  142.    End
  143.    Begin VB.Label Label5 
  144.       Appearance      =   0  'Flat
  145.       BackColor       =   &H80000005&
  146.       BackStyle       =   0  'Transparent
  147.       Caption         =   "SMTP Server"
  148.       ForeColor       =   &H0000FF00&
  149.       Height          =   255
  150.       Left            =   120
  151.       TabIndex        =   5
  152.       Top             =   840
  153.       Width           =   975
  154.    End
  155.    Begin VB.Label Label4 
  156.       Appearance      =   0  'Flat
  157.       BackColor       =   &H80000005&
  158.       BackStyle       =   0  'Transparent
  159.       Caption         =   "POP Server"
  160.       ForeColor       =   &H0000FF00&
  161.       Height          =   255
  162.       Left            =   120
  163.       TabIndex        =   4
  164.       Top             =   480
  165.       Width           =   975
  166.    End
  167.    Begin VB.Label cmdReset 
  168.       Alignment       =   2  'Center
  169.       Appearance      =   0  'Flat
  170.       BackColor       =   &H00FF8080&
  171.       BorderStyle     =   1  'Fixed Single
  172.       Caption         =   "Reset"
  173.       BeginProperty Font 
  174.          Name            =   "MS Serif"
  175.          Size            =   6
  176.          Charset         =   0
  177.          Weight          =   700
  178.          Underline       =   0   'False
  179.          Italic          =   0   'False
  180.          Strikethrough   =   0   'False
  181.       EndProperty
  182.       ForeColor       =   &H80000008&
  183.       Height          =   255
  184.       Left            =   3240
  185.       TabIndex        =   3
  186.       Top             =   4920
  187.       Width           =   855
  188.    End
  189.    Begin VB.Label cmdCancel 
  190.       Alignment       =   2  'Center
  191.       Appearance      =   0  'Flat
  192.       BackColor       =   &H00FF8080&
  193.       BorderStyle     =   1  'Fixed Single
  194.       Caption         =   "Cancel"
  195.       BeginProperty Font 
  196.          Name            =   "MS Serif"
  197.          Size            =   6
  198.          Charset         =   0
  199.          Weight          =   700
  200.          Underline       =   0   'False
  201.          Italic          =   0   'False
  202.          Strikethrough   =   0   'False
  203.       EndProperty
  204.       ForeColor       =   &H80000008&
  205.       Height          =   255
  206.       Left            =   2400
  207.       TabIndex        =   2
  208.       Top             =   4920
  209.       Width           =   855
  210.    End
  211.    Begin VB.Image imgClose 
  212.       Height          =   210
  213.       Left            =   5520
  214.       Picture         =   "frmEmailSetup.frx":02E2
  215.       Top             =   0
  216.       Width           =   225
  217.    End
  218.    Begin VB.Label Label3 
  219.       BackStyle       =   0  'Transparent
  220.       Caption         =   "Email CLient Setup"
  221.       BeginProperty Font 
  222.          Name            =   "MS Serif"
  223.          Size            =   6.75
  224.          Charset         =   0
  225.          Weight          =   400
  226.          Underline       =   0   'False
  227.          Italic          =   0   'False
  228.          Strikethrough   =   0   'False
  229.       EndProperty
  230.       ForeColor       =   &H00FFFF00&
  231.       Height          =   255
  232.       Left            =   840
  233.       TabIndex        =   1
  234.       Top             =   0
  235.       Width           =   1215
  236.    End
  237.    Begin VB.Label cmdOK 
  238.       Alignment       =   2  'Center
  239.       Appearance      =   0  'Flat
  240.       BackColor       =   &H00FF8080&
  241.       BorderStyle     =   1  'Fixed Single
  242.       Caption         =   "OK"
  243.       BeginProperty Font 
  244.          Name            =   "MS Serif"
  245.          Size            =   6
  246.          Charset         =   0
  247.          Weight          =   700
  248.          Underline       =   0   'False
  249.          Italic          =   0   'False
  250.          Strikethrough   =   0   'False
  251.       EndProperty
  252.       ForeColor       =   &H80000008&
  253.       Height          =   255
  254.       Left            =   1560
  255.       TabIndex        =   0
  256.       Top             =   4920
  257.       Width           =   855
  258.    End
  259.    Begin VB.Image Image1 
  260.       Height          =   5415
  261.       Left            =   -1200
  262.       Picture         =   "frmEmailSetup.frx":05C4
  263.       Stretch         =   -1  'True
  264.       Top             =   -120
  265.       Width           =   6975
  266.    End
  267. Attribute VB_Name = "frmEmailSetup"
  268. Attribute VB_GlobalNameSpace = False
  269. Attribute VB_Creatable = False
  270. Attribute VB_PredeclaredId = True
  271. Attribute VB_Exposed = False
  272. Option Explicit
  273. Dim AppPath As String
  274. Private Sub cmdAddPOP_Click()
  275. Dim I As Integer
  276. For I = 0 To cmbPOP.ListCount - 1
  277.  If cmbPOP.List(I) = cmbPOP.Text Then Exit Sub
  278. Next I
  279. cmbPOP.AddItem cmbPOP.Text
  280. '//// Put the code to save the server list here
  281. UpdateList AppPath & "POPserver.txt", cmbPOP.Text
  282. End Sub
  283. Private Sub cmdAddSMTP_Click()
  284. Dim I As Integer
  285. For I = 0 To cmbSMTP.ListCount - 1
  286.  If cmbSMTP.List(I) = cmbSMTP.Text Then Exit Sub
  287. Next I
  288. cmbSMTP.AddItem cmbSMTP.Text
  289. '//// Put the code to save the server list here
  290. UpdateList AppPath & "SMTPserver.txt", cmbSMTP.Text
  291. End Sub
  292. Private Sub cmdCancel_Click()
  293.  Unload Me
  294. End Sub
  295. Private Sub cmdOK_Click()
  296. POPAddress = Trim$(cmbPOP.Text)
  297. SMTPAddress = Trim$(cmbSMTP.Text)
  298. SMTPDomain = Trim$(txtDomain.Text)
  299. EmailUsername = Trim$(txtUsername.Text)
  300. EmailPass = Trim$(txtPass.Text)
  301. 'UPdate the lists
  302. cmdAddPOP_Click
  303. cmdAddSMTP_Click
  304. 'Clear the password field
  305. If chkSavePAssword.Value = 0 Then
  306.  txtPass.Text = ""
  307. End If
  308. Unload Me
  309. End Sub
  310. Private Function RetrieveList(strFilename As String, intRecordNumber As Integer) As String
  311. Dim Filenum As Integer
  312. Dim LineInFile As Integer
  313. Dim strBuffer As String
  314. LineInFile = 0
  315. 'Check the availability of file
  316.  If Dir(strFilename) = "" Then
  317.   RetrieveList = "Err"
  318.   Exit Function
  319.  End If
  320. Filenum = FreeFile 'Assign the file handle
  321. Open strFilename For Input As Filenum
  322.  Input #Filenum, strBuffer
  323.  LineInFile = LineInFile + 1
  324. Loop Until LineInFile = intRecordNumber
  325. 'Close the file
  326. Close Filenum
  327. RetrieveList = strBuffer
  328. End Function
  329. Private Function UpdateList(strFilename As String, strData As String) As Boolean
  330. Dim Filenum As Integer
  331. Dim FileOpened As Boolean
  332. On Error GoTo Erh:
  333. Filenum = FreeFile
  334. Open strFilename For Append As #Filenum
  335. FileOpened = True
  336. Write #Filenum, strData
  337. Close Filenum
  338. FileOpened = False
  339. On Error GoTo 0
  340. If FileOpened Then Close Filenum
  341. End Function
  342. Private Function CountList(strFilename As String) As Integer
  343. Dim I As Integer
  344. Dim Filenum As Integer
  345. Dim FileOpened As Boolean
  346. Dim strDummy As String
  347. 'Check the availability of file
  348.  If Dir(strFilename) = "" Then
  349.   CountList = 0
  350.   Exit Function
  351.  End If
  352. Filenum = FreeFile
  353. Open strFilename For Input As Filenum
  354. FileOpened = True
  355.  Input #Filenum, strDummy
  356.  I = I + 1
  357. Loop Until EOF(Filenum) = True
  358. Close Filenum
  359. FileOpened = False
  360. CountList = I
  361. If FileOpened Then Close Filenum
  362. End Function
  363. Private Sub cmdReset_Click()
  364.  Form_Load
  365. End Sub
  366. Private Sub Form_Load()
  367. Dim I As Integer
  368. Dim I2 As Integer
  369. Dim strPOP As String
  370. Dim strSMTP As String
  371. 'Set the application path
  372. AppPath = App.Path
  373. If Right$(AppPath, 1) <> "\" Then AppPath = AppPath & "\"
  374. If Dir(AppPath & "POPserver.txt") <> "" Then
  375.  'Update pop servers list
  376.  I = CountList(AppPath & "POPserver.txt")
  377.  For I2 = 1 To I
  378.   strPOP = RetrieveList(AppPath & "POPserver.txt", I2)
  379.   cmbPOP.AddItem strPOP
  380.  Next I2
  381. End If
  382. If Dir(AppPath & "SMTPserver.txt") <> "" Then
  383.  I = CountList(AppPath & "SMTPserver.txt")
  384.  For I2 = 1 To I
  385.   strSMTP = RetrieveList(AppPath & "SMTPserver.txt", I2)
  386.   cmbSMTP.AddItem strSMTP
  387.  Next I2
  388. End If
  389. End Sub
  390. Private Sub Label1_Click()
  391. End Sub
  392.